{% if messages %}
    {# Messages container - positioned at top-right #}
    <div class="tw:opacity-0 tw:animate-fade-out tw:fixed tw:top-4 tw:right-4 tw:z-50 tw:space-y-2 tw:w-lg tw:max-w-2xl tw:border tw:rounded-box">
        {% for message in messages %}
            <div role="alert" class="tw:alert">
                {% if message.level_tag == 'success' %}
                    <svg xmlns="http://www.w3.org/2000/svg" class="tw:text-success tw:h-6 tw:w-6 tw:shrink-0 tw:stroke-current" fill="none" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
                    </svg>
                {% elif message.level_tag == 'error' %}
                    <svg xmlns="http://www.w3.org/2000/svg" class="tw:text-error tw:h-6 tw:w-6 tw:shrink-0 tw:stroke-current" fill="none" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
                    </svg>
                {% elif message.level_tag == 'warning' %}
                    <svg xmlns="http://www.w3.org/2000/svg" class="tw:text-warning tw:h-6 tw:w-6 tw:shrink-0 tw:stroke-current" fill="none" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
                    </svg>
                {% else %} {# Default/info #}
                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="tw:text-info tw:stroke-info tw:h-6 tw:w-6 tw:shrink-0">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                    </svg>
                {% endif %}

                <span>{{message}}</span>
            </div>
        {% endfor %}
    </div>
{% endif %}
